package com.yonyou.dmm.service;

import com.yonyou.ucf.mdd.ext.dao.meta.MetaDaoHelper;
import lombok.extern.slf4j.Slf4j;
import org.imeta.orm.schema.QueryCondition;
import org.imeta.orm.schema.QuerySchema;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;

import java.util.Map;

@Slf4j
@Service
public class DMMExpenseCardService {

    public Map<String, Object> getExpenseCardByProject(String projectId, String finance_org) throws Exception {
        Assert.notNull(projectId,"项目ID不能为空！！！");
        Assert.notNull(finance_org,"组织ID不能为空！！！");
        Map<String, Object> res = MetaDaoHelper.queryOne(
                "zyhyspring2024.zyhyspring2024.dmm_card",
                QuerySchema.create()
                        .addSelect("*")
                        .appendQueryCondition(
                                QueryCondition.name("project").eq(projectId),
                                QueryCondition.name("finance_org").eq(finance_org)
                        )
        );
        return res;
    }

}
